<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:QuickZip.IO.PIDL.UserControls"
    xmlns:vm="clr-namespace:QuickZip.IO.PIDL.UserControls.ViewModel"
    xmlns:uc="http://www.quickzip.org/UserControls"
    >
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/QuickZip.IO.PIDL.UserControls;component/Themes/Converters.xaml" />
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Styles/StaticProgressBarStyle.xaml" />
        <ResourceDictionary Source="Common.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="subText" BasedOn="{StaticResource {x:Type TextBlock}}" TargetType="TextBlock">
        <Setter Property="FontSize" Value="10" />
        <Setter Property="Foreground" Value="Gray" />
    </Style>


    <local:ExDataTemplateSelector x:Key="EntryTemplateSelector"  TemplateType="Entry" Mode="3" />


    <DataTemplate x:Key="EntryDriveTemplate">
        <StackPanel Orientation="Vertical" Margin="10,0,0,0" VerticalAlignment="Center">
            <uc:EditBox x:Name="eb" DisplayValue="{Binding EmbeddedModel.Label}" 
                        ActualValue="{Binding EmbeddedModel.Name, Mode=TwoWay}" 
                        IsEditable="False"        
                        IsEditing="{Binding Path=(local:FileList.IsEditing),
                                    RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}, Mode=TwoWay}"
                        />
            <TextBlock Text="{Binding EmbeddedModel.DriveType}" Style="{StaticResource subText}"                        
                       />
            <ProgressBar HorizontalAlignment="Stretch" Margin="0,2,10,0" Foreground="CadetBlue" Style="{StaticResource staticProgressBarStyle}"
                                 Visibility="{Binding EmbeddedModel.IsReady, Converter={StaticResource btv}}"
                                 Height="10" Value="{Binding EmbeddedModel.PercentFull, Mode=OneWay}" Maximum="100" />
            <Grid DockPanel.Dock="Bottom" Visibility="{Binding EmbeddedModel.IsReady, Converter={StaticResource btv}}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <StackPanel Orientation="Horizontal" Grid.Column="0">
                    <TextBlock Text="Free :" Style="{StaticResource subText}" />
                    <TextBlock Text="{Binding Path=EmbeddedModel.FreeSpace, Converter={StaticResource ffs}}" Style="{StaticResource subText}" Margin="0,0,2,0" />
                </StackPanel>
                <StackPanel Orientation="Horizontal" Grid.Column="1">
                    <TextBlock Text="Total :" Style="{StaticResource subText}" />
                    <TextBlock Text="{Binding Path=EmbeddedModel.TotalSize, Converter={StaticResource ffs}}" Style="{StaticResource subText}" />
                </StackPanel>
            </Grid>

        </StackPanel>
    </DataTemplate>

    <DataTemplate x:Key="EntryDirectoryTemplate">
        <StackPanel Orientation="Vertical" Margin="10,0,0,0" VerticalAlignment="Center">
            <uc:EditBox x:Name="eb" DisplayValue="{Binding EmbeddedModel.Label}" 
                        ActualValue="{Binding EmbeddedModel.Name, Mode=TwoWay}" 
                        IsEditable="{Binding EmbeddedModel.IsEditable}"        
                        IsEditing="{Binding Path=(local:FileList.IsEditing),
                                    RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}, Mode=TwoWay}"
                        />            
            <TextBlock Text="{Binding EmbeddedModel.EntryType}" Style="{StaticResource subText}" />
        </StackPanel>
    </DataTemplate>

    <DataTemplate x:Key="EntryFileTemplate">
        <StackPanel Orientation="Vertical" Margin="10,0,0,0" VerticalAlignment="Center">
            <uc:EditBox x:Name="eb" DisplayValue="{Binding EmbeddedModel.Label}" 
                        ActualValue="{Binding EmbeddedModel.Name, Mode=TwoWay}" 
                        IsEditable="{Binding EmbeddedModel.IsEditable}"        
                        IsEditing="{Binding Path=(local:FileList.IsEditing),
                                    RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}, Mode=TwoWay}"
                        />
            <TextBlock Text="{Binding EmbeddedModel.Length, Converter={StaticResource ffs}}" />
            <TextBlock Text="{Binding EmbeddedModel.EntryType}" Style="{StaticResource subText}" />
        </StackPanel>
    </DataTemplate>
    
    

    <uc:VirtualWrapPanelView x:Key="TileView"  ColumnHeaderContainerStyle="{StaticResource ColumnHeaderContainerStyle}" SmallChanges="60"
                             ItemHeight="60" ItemWidth="238" HorizontalContentAlignment="Left" >
        <uc:VirtualWrapPanelView.ItemTemplate>
            <DataTemplate>
                <DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="238" Height="50">
                    <Image x:Name="img" Source="{Binding Converter={StaticResource amti}, ConverterParameter=35}" Width="35" Height="35"/>
                    <ContentPresenter Content="{Binding}" ContentTemplateSelector="{StaticResource EntryTemplateSelector}" />
                </DockPanel>
            </DataTemplate>
        </uc:VirtualWrapPanelView.ItemTemplate>
        <uc:VirtualWrapPanelView.Columns>
            <GridViewColumn Width="100" Header="Name" local:FileList.SortPropertyName="sortByFullName" />    
            <GridViewColumn Width="100" Header="Type" local:FileList.SortPropertyName="sortByType" />
            <GridViewColumn Width="100" Header="Time" local:FileList.SortPropertyName="sortByLastWriteTime" />
            <GridViewColumn Width="100" Header="Size" local:FileList.SortPropertyName="sortByLength" />
        </uc:VirtualWrapPanelView.Columns>
    </uc:VirtualWrapPanelView>

</ResourceDictionary>
